<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Map"%>
<%@page import="com.yaodian100.ec.product.entity.OrderComment"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="imgDomain"><%=ServerValue.getImgDomain()%></c-rt:set>
<c-rt:set var="frontContextPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<html>
<head>
<link rel="stylesheet" href="/css/yaodian100_v2.css" type="text/css" media="screen,print" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script language="javascript">
$().ready(function(){
	$("#m_mycomment").css("font-weight","bold");
	$("#m2dialog").dialog({
		bgiframe: true,
		width:300,
		modal: true,
		autoOpen: false
	});
	
	$("#cbAll").click(function(){
		$(":input[id*=cb_]").attr('checked',$("#cbAll").attr('checked'));
	});
	$(":input[id*=cb_]").click(function(){
		if($(":input[id*=cb_]").size() == $(":input[id*=cb_][checked]").size()){
			$("#cbAll").attr('checked',true);
		}else{
			$("#cbAll").removeAttr('checked');
		}
	});
	$(":input[id=go_next]").click(function(){
		var isFirst = true;
		detailProdIds = "";
		$(":input[id*=cb_]").each(function(){
			var text = $(this).attr('id').split('_')[1];
			if($("#cb_"+text).attr('checked')==true){
				if(isFirst){
					detailProdIds = text;
					isFirst = false;
				}else{
					detailProdIds+= ","+text;
				}
			}
		});
		$("#detailProdId").val(detailProdIds);
		if(detailProdIds.length==0){
			$("#m2dialog").dialog('open');
			return false;
		}
		$('#mycommentForm').submit();
		return false;
	});
	
	$("#m2_ok").click(function(){
		$("#m2dialog").dialog('close');
	});
});
</script>
</head>
<body>
<s:form action="mycomment/addcomment.do" id="mycommentForm" name="mycommentForm" method="post">
<input type="hidden" id="detailProdId" name="detailProdId" value="">
<!-- content start -->
    <div class="content">
    <h2>购买评价</h2>
    <div class="mb-show">
      <ul class="mb-tab">
            <li class="mb-tab-f"><a href="${frontContextPath}/member/mycomment/mycomment.do?p=1">可评价的商品(${htmlContent.totalCount})</a></li>
            <li><a href="${frontContextPath}/member/mycomment/commentHistory.do?p=1">已发表的评价(${commentHistoryListSize})</a></li>
		  </ul><div class="a-function"><a href="#comment-rule">了解具体评价规则</a></div>
		   <c:if test="${htmlContent.totalCount ==0}">
		   <div class="no-cmt-table">
           	<div>
	           <strong class="txt-m">您目前没有可评价的商品，可能有以下的原因：</strong>
	           <ol class="list-num">
	            <li>您已经评价过所有已购买的商品。</li>
	            <li>距您上次购买商品的时间已经超过半年。</li>
	            <li>您可能還没有在耀点100购买过商品。</li>
	           </ol>
	           </div>
	       </div>
	       </c:if>
		  
	<c:if test="${htmlContent.totalCount > 0}">	  
      <p><label class="cmt-selectall"><input type="checkbox" id="cbAll" />&nbsp;全选&nbsp;<button id="go_next">评价选中的商品</button>
      </label></p>
	   <table id="pTable" class="tablesorter {sortlist: [[3,1]]} tb-2">
        <thead>
          <tr>
            <th width="20"></th>
            <th width="80">商品图片</th>
            <th>商品名称</th>
            <th width="70">购买时间</th>
            <th width="120">操作</th>
          </tr>
        </thead>
       <tbody id="pTable_body">
       <c-rt:forEach items="${htmlContent.orderCommentList}" var="orderData" varStatus="status">
          <tr>
            <td><input type="checkbox" id="cb_${orderData[5]}"/></td>
            <td><span>
            <img src="${imgDomain}/PImg/${pu:substring(orderData[0], 0,4) }/${orderData[0]}/${orderData[0]}_m75.jpg" alt="" width="75" height="75"  onError="this.src='/PImg/blank_75.gif'" />
            </span></td>
            <td><p><a href="/ecmall/product/product.do?productId=${orderData[6]}" target="_blank">${orderData[1]} </a><br />${orderData[2]}</p></td>
            <td><fmt:formatDate value="${orderData[4]}" pattern="yyyy-MM-dd" /></td>
            <td><a href="${frontContextPath}/member/mycomment/addcomment.do?detailProdId=${orderData[5]}">立即评价</a></td>
          </tr>
           </c-rt:forEach>   
        </tbody>
      </table>
      
	      <p class="page-change">
			<c:choose>
	         <c:when test="${htmlContent.totalPage==1 || htmlContent.currentPage==1}">
				<span class="a-no">&lt; 上一页</span> |
			 </c:when>
			<c:otherwise>
				<c:if test="${htmlContent.orderType!='HSP'}">	
					<a href="${link }?t=${htmlContent.orderType}&p=${htmlContent.currentPage-1}" class="a-togo">&lt; 上一页</a> |
				</c:if>
				<c:if test="${htmlContent.orderType=='HSP'}">
					<a href="${link }?t=${htmlContent.orderType}&p=${htmlContent.currentPage-1}&s=${htmlContent.selectparm}" class="a-togo">&lt; 上一页</a> |
				</c:if>
			</c:otherwise>
			</c:choose>		
			<c:forEach begin="${htmlContent.startPage}" end="${htmlContent.endPage}" var="i">
				<c:choose>
					<c:when test="${htmlContent.currentPage==i}">
						<b class="pg-now">${i}</b>
					</c:when>
					<c:otherwise>
							<a href="${link}?t=${htmlContent.orderType}&p=${i}">${i}</a>
					</c:otherwise>
				</c:choose>
			</c:forEach>
			<c:choose>
			<c:when test="${htmlContent.currentPage == htmlContent.totalPage}">
				<span class="a-no"> | 下一页 &gt;</span>
			</c:when>
			<c:otherwise>
				<c:if test="${htmlContent.orderType!='HSP'}">	
				 | <a href="${link }?t=${htmlContent.orderType}&p=${htmlContent.currentPage+1}" class="a-togo">下一页 &gt;</a>
				</c:if>
				<c:if test="${htmlContent.orderType=='HSP'}">
				 | <a href="${link }?t=${htmlContent.orderType}&p=${htmlContent.currentPage+1}&s=${htmlContent.selectparm}" class="a-togo">下一页 &gt;</a>
				</c:if>
			</c:otherwise>
			</c:choose>
		 </p>
	</c:if>
      
          <p align="right"><a href="#"><span class="a-top"></span>Top</a></p>
          
          <a name="comment-rule" id="comment-rule"></a>
          <!-- 注意事项 -->
          <div class="txt-note">
              <strong>评价规则：</strong>
              <ol class="list-num">
                <li>只能对在半年内购买的商品进行评价，评价通过审核后可在商品页显示并且获得积分，赠品可以评价但不送积分。</li>
                <li>同一订单或相隔15日内订单中相同商品的相同属性，只有一次评价可以获得积分。</li>
                <li>若审核不通过，可在30天内修改一次评价后重新审核。</li>
                <li>评价后15分钟内可修改，逾时则不能修改。</li>
                <li>欢迎您发表有价值的评价，拷贝他人内容、内容重复，过多标点符号等情况很难通过审核。</li>
              </ol>
          </div>
          <!-- 注意事项 -->
        
	</div>
      <!-- 內容 -->
      <!-- 內容 -->
    </div>
    <!-- content end -->
</s:form>
</body>
</html>
<div id="m2dialog" title="系统提示"  class="alert-caution" style="display:none">
<p><br />您还没有勾选可评价的商品！</p>
<div style="text-align:center;"><a href="javascript:;" class="btn-mid" id="m2_ok">确定</a></div>